package scala.test_traits

import scala.collection.mutable.ArrayBuffer
import scala.test_traits.animal.{Animal, Cat, Dog}

/**
 * @author 黄海峰 2021/4/15 13:48
 * */
object DeanTest {
  def main(args: Array[String]): Unit = {
    val greeter = new SimpleGreeter()
    greeter.greet("dean")
    println("======================>")

    val greeter2 = new SimpleGreeter()
    greeter2.greetDefault("dean")
    println("======================>")

    val iterator = new IntIterator(5)
    println(iterator.next())
    println(iterator.next())
    println("======================>")

    val dog = new Dog("xxx")
    println(dog)
    println(dog.name)
    val cat = new Cat("yyy")
    println(cat.name)
    println("======================>")

    val animals = ArrayBuffer.empty[Animal]
    animals.append(dog)
    animals.append(cat)
    animals.foreach(item=>println(item.name))
    println("======================>")

  }
}
